package com.gan.springcloud.controller;


import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Log4j2
@RestController

public class AccountController {

    @RequestMapping(value = "/getAccount", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> getAccount() {
        log.info("获取客户信息服务, 服务启动");
        Map<String,Object> account = new HashMap<>();
        account.put("id","1");
        account.put("name","小米");
        log.info("id=="+account.get("id")+",name=="+account.get("name"));
        return account;
        //throw new RuntimeException("error");
    }


    //@RequestMapping(value = "/setAccount", method = RequestMethod.GET)
    @GetMapping("/setAccount/{name}")
    @ResponseBody
    public Map<String,Object> setAccount(@PathVariable("name") String name) {
        log.info("获取客户信息服务, 服务启动");
        Map<String,Object> account = new HashMap<>();
        account.put("id","1");
        account.put("name",name);
        log.info("id=="+account.get("id")+",name=="+account.get("name"));
        return account;
        //throw new RuntimeException("error");
    }
}
